package org.blog.model;

public class ModelUserInfo extends BaseModel implements ValidateModel {

	// private String username;
	private String nickname;// 10
	private Integer sex;// 0:男，1:女
	private String ava;// 100
	private Long createTime;// 13
	private Long actionTime;// 13
	private Integer action;// 状态 1：添加，2：修改，3：删除

	// public String getUsername() {
	// return username;
	// }
	//
	// public void setUsername(String username) {
	// this.username = username;
	// }

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public String getAva() {
		return ava;
	}

	public void setAva(String ava) {
		this.ava = ava;
	}

	public Long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Long createTime) {
		this.createTime = createTime;
	}

	public Long getActionTime() {
		return actionTime;
	}

	public void setActionTime(Long actionTime) {
		this.actionTime = actionTime;
	}

	public Integer getAction() {
		return action;
	}

	public void setAction(Integer action) {
		this.action = action;
	}

	@Override
	public boolean validate(ActionType type) {
		if (ActionType.ADD.equals(type)) {
			if (getSex() == null || getNickname() == null) {
				return false;
			}
		} else if (ActionType.MODIFY.equals(type)) {
			if (getSex() == null || getNickname() == null) {
				return false;
			}
		}
		return true;
	}

}
